package com.zzf.rpc;

import java.lang.reflect.Proxy;

/**
 * @author zzf
 * @date 2018/8/13 13:37.
 */
public class RpcClientProxy {


//    private String host;
//    private int port;
//
//    public RpcClientProxy(String host, int port) {
//        this.host = host;
//        this.port = port;
//    }

    public <T> T clientProxy(final Class<T> interfaceCls, final String host, final int port) {

        return (T)Proxy.newProxyInstance(interfaceCls.getClassLoader(), new Class[]{interfaceCls},
                new RemoteInvocationHandler(host, port));
    }
}
